home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / ikHandleOptionLayout.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  6.8 KB  |  291 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:    Jan. 6, 97
  22. //  Author:            ap
  23. //
  24. //  Description:    defines behaviour and layout of ik handle portion
  25. //                    of the jointContext tool property sheet
  26. //
  27.  
  28.  
  29. global proc ikHandlePropCallback(string $parent, string $whichCallback)
  30. //
  31. //    Procedure Name:
  32. //        ikHandlePropCallback
  33. //
  34. //    Description:
  35. //        Callbacks for the IK Handle Tool Property Sheet in joint tool.
  36. //
  37. //    Input Arguments:
  38. //        Parent name, and
  39. //        current callback name.
  40. //
  41. //    Return Value:
  42. //        None.
  43. //
  44. {
  45.     setParent    $parent;
  46.     string        $whichCtx = `currentCtx`;
  47.  
  48.     switch ($whichCallback)
  49.     {
  50.         case "selectedIKSolver":
  51.             string $solverName = `optionMenuGrp -q -value ikHandleOptionMenu`;
  52.             jointCtx -e -solverTypeH $solverName $whichCtx;
  53.             break;
  54.  
  55.         case "autoPriorityOn":
  56.             intSliderGrp -e -enable false priority;
  57.             jointCtx -e -autoPriorityH true $whichCtx;
  58.             break;
  59.  
  60.         case "autoPriorityOff":
  61.             intSliderGrp -e -enable true priority;
  62.             jointCtx -e -autoPriorityH false $whichCtx;
  63.             break;
  64.  
  65.         case "snapHandleHOn":
  66.             jointCtx -e -snapHandleH true $whichCtx;
  67.             break;
  68.  
  69.         case "snapHandleHOff":
  70.             jointCtx -e -snapHandleH false $whichCtx;
  71.             break;
  72.  
  73.         case "forceSolverHOn":
  74.             jointCtx -e -forceSolverH true $whichCtx;
  75.             break;
  76.  
  77.         case "forceSolverHOff":
  78.             jointCtx -e -forceSolverH false $whichCtx;
  79.             break;
  80.  
  81.         case "stickyHOn":
  82.             jointCtx -e -stickyH sticky $whichCtx;
  83.             break;
  84.  
  85.         case "stickyHOff":
  86.             jointCtx -e -stickyH off $whichCtx;
  87.             break;
  88.  
  89.         case "priorityHValue":
  90.             int $p = `intSliderGrp -q -v priority`;
  91.             jointCtx -e -priorityH $p $whichCtx;
  92.             break;
  93.  
  94.         case "weightHValue":
  95.             float $w = `floatSliderGrp -q -v handleWeight`;
  96.             jointCtx -e -weightH $w $whichCtx;
  97.             break;
  98.  
  99.         case "poWeightHValue":
  100.             float $pow = `floatSliderGrp -q -v handlePOWeight`;
  101.             jointCtx -e -poWeightH $pow $whichCtx;
  102.             break;
  103.  
  104.         default:
  105.             break;
  106.     }
  107. }
  108.  
  109.  
  110. global proc ikHandleSetCallbacks (string $parent)
  111. //
  112. //    Procedure Name:
  113. //        ikHandleSetCallbacks
  114. //
  115. //    Description:
  116. //        associate control events with callbacks
  117. //
  118. //    Input Arguments:
  119. //        parent name.
  120. //
  121. //    Return Value:
  122. //        None.
  123. //
  124. {
  125.     setParent    $parent;
  126.  
  127.     optionMenuGrp -e
  128.         -cc `CBG "ikHandleProp" $parent "selectedIKSolver"`
  129.         ikHandleOptionMenu;
  130.  
  131.     checkBoxGrp -e
  132.         -on1 `CBG "ikHandleProp" $parent "autoPriorityOn"`
  133.         -of1 `CBG "ikHandleProp" $parent "autoPriorityOff"`
  134.         autoPriorityGrp;
  135.  
  136.     checkBoxGrp -e
  137.         -on1 `CBG "ikHandleProp" $parent "snapHandleHOn"`
  138.         -of1 `CBG "ikHandleProp" $parent "snapHandleHOff"`
  139.         snapHandleGrp;
  140.  
  141.     checkBoxGrp -e
  142.         -on1 `CBG "ikHandleProp" $parent "forceSolverHOn"`
  143.         -of1 `CBG "ikHandleProp" $parent "forceSolverHOff"`
  144.         forceSolverGrp;
  145.  
  146.     //=====================================================
  147.     // For maya1.0, there is not superSticky yet. So in UI,
  148.     // use checkBox to turn on/off sticky.
  149.     //
  150.     // Use radioButtonGrp when implementing superSticky.
  151.     //=====================================================
  152.     //radioButtonGrp -e
  153.     //    -on1 `CBG "ikHandleProp" $parent "stickyOff"`
  154.     //    -on2 `CBG "ikHandleProp" $parent "stickySticky"`
  155.     //    -on3 `CBG "ikHandleProp" $parent "stickySuperSticky"`
  156.     //    stickyGrp;
  157.     checkBoxGrp -e
  158.         -on1 `CBG "ikHandleProp" $parent "stickyHOn"`
  159.         -of1 `CBG "ikHandleProp" $parent "stickyHOff"`
  160.         stickyGrp;
  161.  
  162.     intSliderGrp -e
  163.         -cc `CBG "ikHandleProp" $parent "priorityHValue"`
  164.         priority;
  165.  
  166.     floatSliderGrp -e
  167.         -cc `CBG "ikHandleProp" $parent "weightHValue"`
  168.         handleWeight;
  169.  
  170.     floatSliderGrp -e
  171.         -cc `CBG "ikHandleProp" $parent "poWeightHValue"`
  172.         handlePOWeight;
  173.  
  174.     return;
  175. }
  176.  
  177.  
  178. global proc ikHandleOptionLayout(string $parentN, int $cl )
  179. //
  180. //    Procedure Name:
  181. //        ikHandleOptionLayout
  182. //
  183. //    Description:
  184. //        jointTool property sheet shares this proc to create ikHandle part.
  185. //
  186. {
  187.     string    $parent;
  188.     string    $solvers[];
  189.     string    $solverType;
  190.     int        $itemNum;
  191.     int        $i;
  192.  
  193.     setParent $parentN;
  194.  
  195.     setUITemplate -pushTemplate OptionsTemplate;
  196.     
  197.     frameLayout -cll true -cl $cl -l "IK Handle Settings" ikHandleFrame;
  198.         columnLayout ikHandleOptions;
  199.             separator -style "none";
  200.             $parent = `setParent -query`;
  201.  
  202.             optionMenuGrp -l "Current Solver" ikHandleOptionMenu;
  203.             $solvers = `ikSystem -q -ls`;
  204.             $itemNum = 0;
  205.             for( $i = 0; $i < size($solvers); $i++ )
  206.             {
  207.                 $solverType = `objectType $solvers[$i]`;
  208.                 if( $solverType != "ikSplineSolver" )
  209.                 {
  210.                     menuItem -l $solvers[$i] ($solvers[$i] + $itemNum);
  211.                     $itemNum++;
  212.                 }
  213.             }
  214.  
  215.             separator -hr true sep1;
  216.  
  217.             checkBoxGrp
  218.                 -label ""
  219.                 -numberOfCheckBoxes 1
  220.                 -l1 "Autopriority"
  221.                 autoPriorityGrp;
  222.  
  223.             checkBoxGrp
  224.                 -label ""
  225.                 -numberOfCheckBoxes 1
  226.                 -l1 "Solver Enable"
  227.                 forceSolverGrp;
  228.  
  229.             checkBoxGrp
  230.                 -label ""
  231.                 -numberOfCheckBoxes 1
  232.                 -l1 "Snap Enable"
  233.                 snapHandleGrp;
  234.  
  235.             //=====================================================
  236.             // For maya1.0, there is not superSticky yet. So in UI,
  237.             // use checkBox to turn on/off sticky.
  238.             //
  239.             // Use radioButtonGrp when implementing superSticky.
  240.             //=====================================================
  241.             //radioButtonGrp
  242.             //    -label "Stickies "
  243.             //    -numberOfRadioButtons 3
  244.             //    -labelArray3 "Off" "Sticky" "Super Sticky"
  245.             //    -columnWidth4 150 80 80 120
  246.             //    stickyGrp;
  247.             checkBoxGrp
  248.                 -label ""
  249.                 -numberOfCheckBoxes 1
  250.                 -l1 "Sticky"
  251.                 stickyGrp;
  252.  
  253.             separator -hr true sep2;
  254.  
  255.             intSliderGrp
  256.                 -field 1
  257.                 -label "Priority"
  258.                 -minValue 0
  259.                 -value 1
  260.                 priority;
  261.  
  262.             floatSliderGrp
  263.                 -field 1
  264.                 -label "Weight"
  265.                 -minValue 0.0
  266.                 -maxValue 100.0
  267.                 -step 0.1
  268.                 -value 1.0
  269.                 handleWeight;
  270.  
  271.             floatSliderGrp
  272.                 -field 1
  273.                 -label "POWeight"
  274.                 -minValue 0.0
  275.                 -maxValue 1.0
  276.                 -step 0.001
  277.                 -value 1.0
  278.                 handlePOWeight;
  279.  
  280.         setParent ..; // ikHandleOptions
  281.     setParent ..; // ikHandleFrame
  282.  
  283.     setUITemplate -popTemplate;
  284.  
  285.     ikHandleSetCallbacks( $parent );
  286.  
  287.     clear($solvers);
  288.  
  289.     return;
  290. }
  291.